package org.catdroid.bcnappsjam.barcelonaparticipa;

import org.catdroid.bcnappsjam.barcelonaparticipa.task.base.FewlapsTaskLauncher;
import org.catdroid.bcnappsjam.barcelonaparticipa.task.base.SendTask;
import org.catdroid.bcnappsjam.barcelonaparticipa.util.LoadingIconUtil;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

public class SendingActivity extends Activity implements FewlapsTaskLauncher {

	public static final String EXTRA_OPINIO_ID = "extraOpinioId";

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.sending);
		LoadingIconUtil.startLoading(this);

		String resposta = getIntent().getStringExtra(EXTRA_OPINIO_ID);
		Log.i("SENDING", resposta);

		SendTask.call(this, this, resposta);
	}

	public void executeSync(Object value) {
		// Mai passarà
	}

	public void executeAsyncOk(Object value) {
		Intent i = new Intent(this, GraphicsActivity.class);
		i.putExtra(GraphicsActivity.EXTRA_JSON, value.toString());
		startActivity(i);
		finish();
	}

	public void executeAsyncError(Exception e) {

	}
}
